package net.sf.yacas;

/**
 * class LispPtr. This class is a smart pointer type class to Lisp objects that
 * can be inserted into linked lists. They do the actual reference counting, and
 * consequent destruction of the object if nothing points to it. LispPtr is used
 * in LispObject as a pointer to the next object, and in diverse parts of the
 * built-in internal functions to hold temporary values.
 */
class LispPtr {
	public LispPtr() {
		object = null;
	}

	public LispPtr(LispPtr aOther) {
		object = aOther.object;
	}

	public LispPtr(LispObject aOther) {
		object = aOther;
	}

	final public void setObject(LispObject object) {
		this.object = object;
	}

	final public LispObject getObject() {
		return object;
	}

	final public void GoNext() {
		object = object.object;
	}

	final void DoSet(LispObject aNext) {
		object = aNext;
	}

	protected LispObject object;
};
